package person.bing.fbcloud.common.security.util;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

/**
 * @author: mengfanbing
 * @date: 2019/7/5
 */
@Configuration
public class OAuth2ResourceConfig extends ResourceServerConfigurerAdapter {
    /**
     * @description：资源认证服务器，配置对接口的放行
     * @param http
     * @throws Exception
     */
    @Override
    public void configure(HttpSecurity http) throws Exception {
        http
                .headers().frameOptions().disable()
                .and()
                .authorizeRequests().antMatchers("/forumuser").permitAll()
                .anyRequest().authenticated()
                .and()
                .csrf().disable();
    }
}